const BASE_URL = "http://111.229.237.199:3190"

class WYRequest {
    request(url, method, params) {
        return new Promise((resolve, reject) => {
            wx.request({
                url: BASE_URL + url,
                method: method,
                data: params,
                success: res => {
                    resolve(res)
                },
                fail: err => {
                    reject(err)
                }
              })
        })
    }
    
    get(url, params) {
        return this.request(url, "GET", params)
    }

    post(url, data) {
        return this.request(url, "POST", data)
    }
}

const wyRequest = new WYRequest()

export default wyRequest


